<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 语法格式
        // function 构造函数名(params) {
        //     this.属性 = value
        //     this.方法 = function () { }
        // }

        function Star(name, age, sex) {
            this.name = name
            this.age = age
            this.sex = sex
            this.sing = function (song) {
                console.log(song);
            }
        }
        var ldh = new Star('刘德华', 18, '男')
        ldh.sing("17岁")
        // 构造函数首字母大写
        console.log(ldh.name);

        // 只要调用了new Star
        // 就会有一个新的对象
    </script>
</body>

</html>